*Figure 2: Distribution of Answers by Expert

use "Data_ImportantProvisions_240423.dta", clear


foreach expert in "Participant1" "Participant2" "Participant3" "Participant4" "Participant5" "Participant6" "Participant7" "Participant8" "Participant10" "Participant11" "Participant12"{
	foreach var in general_`expert' {
		
		replace `var' = "Very Important" if `var' == "very important"
		tabulate `var', matcell(freq_`var') 
	}
	
	matrix define `expert'_answers = freq_general_`expert'
	svmat double `expert'_answers, name(data_`expert')
	ren data_`expert' data_`expert'
} 

tab general_Participant9, matcell(freq_general_9)
matrix define Participant9_answers = freq_general_9
svmat double Participant9_answers, name(data_Participant9)
ren data_Participant91 data_Participant9

********************************special case: Tew********************************
matrix extra_row = (0)
matrix Participant8_answers = (Participant8_answers\extra_row)
svmat double Participant8_answers, name(data_Participant8)
drop data_Participant8
ren data_Participant81 data_Participant8


****************************************************************

gen label_counts_part8 = ""
replace label_counts_part8 = "Neutral" if data_Participant8 == 55
replace label_counts_part8 = "Somewhat Import." if data_Participant8 == 179
replace label_counts_part8 = "Somewhat Unimport." if data_Participant8 == 12
replace label_counts_part8 = "Very Import." if data_Participant8 == 94
replace label_counts_part8 = "Very Unimport." if data_Participant8 == 0



gen label_counts = ""
replace label_counts = "Neutral" if data_Participant12 == 51
replace label_counts = "Somewhat Import." if data_Participant12 == 36
replace label_counts = "Somewhat Unimport." if data_Participant12 == 26
replace label_counts = "Very Import." if data_Participant12 == 153
replace label_counts = "Very Unimport." if data_Participant12 == 74



replace data_Participant1 = data_Participant1 / (340)
replace data_Participant2= data_Participant2 / (340)
replace data_Participant3 = data_Participant3 / (340)
replace data_Participant4 = data_Participant4 / (340)
replace data_Participant5 = data_Participant5 / (340)
replace data_Participant6 = data_Participant6 / (340)
replace data_Participant7 = data_Participant7 / (340)
replace data_Participant8 = data_Participant8 / (340)
replace data_Participant9 = data_Participant9 / (340)
replace data_Participant10 = data_Participant10 / (340)
replace data_Participant11 = data_Participant11 / (340)
replace data_Participant12 = data_Participant12 / (340)



gen ord = .
replace ord = 1 if label_counts == "Very Unimport."
replace ord = 2 if label_counts == "Somewhat Unimport."
replace ord = 3 if label_counts == "Neutral"
replace ord = 4 if label_counts == "Somewhat Import."
replace ord = 5 if label_counts == "Very Import."


gen ord_part8 = .
replace ord_part8 = 1 if label_counts_part8 == "Very Unimport."
replace ord_part8 = 2 if label_counts_part8 == "Somewhat Unimport."
replace ord_part8 = 3 if label_counts_part8 == "Neutral"
replace ord_part8 = 4 if label_counts_part8 == "Somewhat Import."
replace ord_part8 = 5 if label_counts_part8 == "Very Import."


graph bar (mean) data_Participant1, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant1, replace) title("Participant 1", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant2, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant2, replace) title("Participant 2",size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant3, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant3, replace) title("Participant 3", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant4, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant4, replace) title("Participant 4", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant5, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant5, replace) title("Participant 5", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant6, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant6, replace) title("Participant 6", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant7, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant7, replace) title("Participant 7", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant8, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant8, replace) title("Participant 8", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant9, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant9, replace) title("Participant 9", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant10, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant10, replace) title("Participant 10", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))
graph bar (mean) data_Participant11, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant11, replace) title("Participant 11", size(vlarge)) ylabel(, labsize(vlarge))
graph bar (mean) data_Participant12, over(label_counts, sort(ord) label(angle(45)) gap(3)) ytitle("Percent", size(medium)) saving(Participant12, replace) title("Participant 12", size(vlarge)) ylabel(0(0.2)0.6, labsize(vlarge))

graph combine Participant1.gph Participant2.gph Participant3.gph Participant4.gph Participant5.gph Participant6.gph Participant7.gph Participant8.gph Participant9.gph Participant10.gph Participant11.gph Participant12.gph, rows(6) scale(0.6) xsize(6) ysize(8)

graph export "Figure_2.pdf", replace


erase Participant1.gph 
erase Participant2.gph 
erase Participant3.gph 
erase Participant4.gph 
erase Participant5.gph 
erase Participant6.gph 
erase Participant7.gph 
erase Participant8.gph 
erase Participant9.gph
erase Participant10.gph
erase Participant11.gph
erase Participant12.gph



